Page({
  data: {
    imgUrls: [
      '/images/detail-appale00.jpg',
      '/images/detail-appale01.jpg',
      '/images/detail-appale02.jpg'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 1000,
    menuList: [{
      name: "商品详情"
    }, {
        // name: "商品详情"
    // }, {
        name: "生长周期"
    }, {
        name: "果农日志"
    }, {
      name: "企业信息"
    }, {
      name: "检验报告"
    }],
    tabScroll: 0,
    currentTab: 0,
    windowHeight: '',
    windowWidth: ''
  },
  onLoad: function() {
    wx.getSystemInfo({ // 获取当前设备的宽高，文档有
      success: (res) => {
        this.setData({
          windowHeight: res.windowHeight,
          windowWidth: res.windowWidth
        })
      },
    })
  },
  onReady: function() {
    wx.setNavigationBarTitle({ //修改标题文字
      title: ''
    })
  },
  clickMenu: function(e) {
    var current = e.currentTarget.dataset.current //获取当前tab的index
    var tabWidth = this.data.windowWidth / 5 // 导航tab共5个，获取一个的宽度
    this.setData({
      tabScroll: (current - 1) * tabWidth //使点击的tab始终在居中位置
    })
    if (this.data.currentTab == current) {
      return false
    } else {
      this.setData({
        currentTab: current
      })
    }
  },
  changeContent: function(e) {
    var current = e.detail.current // 获取当前内容所在index,文档有
    var tabWidth = this.data.windowWidth / 5
    this.setData({
      currentTab: current,
      tabScroll: (current - 1) * tabWidth
    })
  }
})